package com.grts.mall.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.grts.mall.pojo.Cart;
import com.grts.mall.pojo.CartExample;
import com.grts.mall.pojo.CartKey;
import com.grts.mall.pojo.vo.CartResultVo;

@Mapper
public interface CartMapper {
    long countByExample(CartExample example);

    int deleteByExample(CartExample example);

    int deleteByPrimaryKey(CartKey key);

    int insert(Cart record);

    int insertSelective(Cart record);

    List<Cart> selectByExample(CartExample example);

    Cart selectByPrimaryKey(CartKey key);

    int updateByExampleSelective(@Param("record") Cart record, @Param("example") CartExample example);

    int updateByExample(@Param("record") Cart record, @Param("example") CartExample example);

    int updateByPrimaryKeySelective(Cart record);

    int updateByPrimaryKey(Cart record);
    
    @Select("SELECT c.pid, c.uid,c.quantity,p.title ,p.cover, p.price FROM cart c INNER JOIN product p ON c.pid=p.pid WHERE c.uid=#{uid}")
    List<CartResultVo> findByCart(@Param("uid") Long uid);
}